{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Imports\n",
    "\n",
    "Import all the modules and functionalities we need."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "\n",
    "# Import standard libraries.\n",
    "import os\n",
    "\n",
    "# Import third party libraries.\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "from statsmodels.stats.multitest import multipletests\n",
    "\n",
    "# Import custom libraries/scripts.\n",
    "import annotations\n",
    "import helpers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Loading data\n",
    "\n",
    "Fetch all our relevant data for the current analysis."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set working contants.\n",
    "#EXPERIMENTS_PATH = r'D:\\Miguel\\PhD\\Results\\Competition\\DL\\Four-Arena Setup\\WT_mating_status\\processed'\n",
    "EXPERIMENTS_PATH = r'\\\\10.40.12.80\\home\\PhD\\Results\\Competition\\DL\\Four-Arena Setup\\WT_mating_status\\processed'\n",
    "FPS = 60\n",
    "N_MINUTES = 60\n",
    "N_FRAMES = N_MINUTES * 60 * FPS\n",
    "INK = 'black'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set figure configurations.\n",
    "sns.set(\n",
    "        context='paper',\n",
    "        style='ticks',\n",
    "        font='sans-serif',\n",
    "        font_scale=1.0, \n",
    "        rc={\n",
    "            'axes.axisbelow': True,\n",
    "            'axes.edgecolor': INK,\n",
    "            'axes.facecolor': 'white' if INK=='black' else 'black',\n",
    "            'axes.grid': False,\n",
    "            'axes.labelcolor': INK,\n",
    "            'axes.labelsize': 13.0,\n",
    "            'axes.labelweight': 'normal',\n",
    "            'axes.linewidth': 1.0,\n",
    "            'axes.spines.left': True,\n",
    "            'axes.spines.bottom': True,\n",
    "            'axes.spines.top': False,\n",
    "            'axes.spines.right': False,\n",
    "            'axes.titlepad': 15.0,\n",
    "            'axes.titlesize': 20.0,\n",
    "            'axes.titleweight': 'bold',\n",
    "            'figure.facecolor': 'white' if INK=='black' else 'black',\n",
    "            'figure.figsize': [6.0, 4.0],\n",
    "            'figure.titlesize': 30.0,\n",
    "            'figure.titleweight': 'bold',\n",
    "            'font.family': ['sans-serif'],\n",
    "            'font.sans-serif': ['Arial'],\n",
    "            'legend.frameon': False,\n",
    "            'legend.fontsize': 11.0,\n",
    "            'lines.color': INK,\n",
    "            'lines.linewidth': 1.0,\n",
    "            'patch.edgecolor': INK,\n",
    "            'savefig.dpi': 300,\n",
    "            'savefig.format': 'png',\n",
    "            'savefig.bbox': 'tight',\n",
    "            'savefig.transparent': True,\n",
    "            'text.color': INK,\n",
    "            'text.usetex': False,\n",
    "            'xtick.color': INK,\n",
    "            'xtick.direction': 'out',\n",
    "            'xtick.labelsize': 12.0,\n",
    "            'xtick.major.pad': 5.0,\n",
    "            'xtick.major.size': 0.0,\n",
    "            'xtick.major.width': 1.0,\n",
    "            'xtick.minor.size': 0.0,\n",
    "            'xtick.minor.width': 0.4,\n",
    "            'ytick.color': INK,\n",
    "            'ytick.direction': 'out',\n",
    "            'ytick.labelsize': 12.0,\n",
    "            'ytick.major.pad': 5.0,\n",
    "            'ytick.major.size': 3.0,\n",
    "            'ytick.major.width': 1.0,\n",
    "            'ytick.minor.size': 0.0,\n",
    "            'ytick.minor.width': 0.4\n",
    "           }\n",
    "       )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Folder already exists, skipping.\n"
     ]
    }
   ],
   "source": [
    "# Prepare the Figures folder to save our graphs in.\n",
    "savepath = os.path.join(r'C:\\Users\\Miguel\\Desktop\\paper_data', 'paper_figures', 'figure3')\n",
    "try:\n",
    "    os.makedirs(savepath)\n",
    "    print('New folder created.')\n",
    "except FileExistsError:\n",
    "    print('Folder already exists, skipping.')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Paths to conditions:\n",
      " ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h', '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h', '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin']\n"
     ]
    }
   ],
   "source": [
    "# Set the conditions to analyze.\n",
    "condition_order = ['virgin_virgin', 'virgin_mated24h', 'virgin_mated2h']\n",
    "conditions = [item.path for item in os.scandir(EXPERIMENTS_PATH) if item.name in condition_order]\n",
    "print('Paths to conditions:\\n', conditions)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['video_2017-09-05T14_34_55_arena4', 'video_2017-09-12T14_36_55_arena4', 'video_2017-09-14T13_34_41_arena2', 'video_2017-09-21T14_47_10_arena3', 'video_2017-09-21T14_47_10_arena4', 'video_2017-09-26T13_40_19_arena4', 'video_2017-09-27T16_21_07_arena1', 'video_2017-09-27T16_21_07_arena3', 'video_2017-09-28T15_55_49_arena2', 'video_2017-10-12T14_34_41_arena2', 'video_2017-10-18T14_05_05_arena3', 'video_2017-10-19T14_58_20_arena1', 'video_2017-10-24T14_48_34_arena1', 'video_2017-10-24T14_48_34_arena4', 'video_2017-10-25T13_39_35_arena4', 'video_2017-11-03T14_54_45_arena2', 'video_2017-09-05T15_42_04_arena1', 'video_2017-11-02T16_11_06_arena1', 'video_2017-12-19T16_23_33_arena4', 'video_2017-09-05T15_42_04_arena3', 'video_2017-09-07T13_28_02_arena4']\n",
      "21\n"
     ]
    }
   ],
   "source": [
    "# Create a list of all the experiments that we DO NOT want to analyze.\n",
    "intruders = []\n",
    "for condition_path in conditions:\n",
    "    condition = os.path.basename(condition_path)\n",
    "    for file in os.listdir(condition_path):\n",
    "        if 'quality_control' in file:\n",
    "\n",
    "            # Read the quality.csv file to check which experiments are usable for analysis.\n",
    "            quality_file = os.path.join(condition_path, file)\n",
    "            quality_df = pd.read_csv(quality_file, usecols=[0,1], index_col=0)\n",
    "            quality_df = quality_df[quality_df['is_usable'] == False].index.values\n",
    "\n",
    "            for value in quality_df:\n",
    "                intruders.append(value + '_slice1' if condition=='virgin_added' else value)\n",
    "\n",
    "print(intruders)             \n",
    "print(len(intruders))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\t\n",
      " virgin_mated24h\n",
      "Copulation too short: video_2017-09-20T14_48_55_arena3\n",
      "\t\n",
      " virgin_mated2h\n",
      "\t\n",
      " virgin_virgin\n",
      "Copulation too short: video_2017-09-06T13_42_13_arena3\n",
      "Copulation too short: video_2017-09-26T14_52_18_arena3\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'virgin_virgin': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-05T13_28_41_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-05T14_34_55_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-06T13_42_13_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-06T14_45_32_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-07T14_37_38_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-07T14_37_38_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-08T13_26_13_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-12T13_30_06_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-12T14_36_55_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-12T16_18_15_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-13T14_34_18_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-20T13_43_53_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-20T14_48_55_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-21T13_38_55_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-21T15_57_23_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-26T13_40_19_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-28T13_36_06_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-28T14_44_01_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-28T15_55_49_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-12T15_50_43_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-13T16_06_33_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-18T15_19_17_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-19T13_50_56_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-20T13_21_06_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-20T15_44_09_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-24T16_13_35_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-25T14_55_12_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-02T13_37_48_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-02T14_48_28_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-02T16_11_06_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-03T14_54_45_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-03T16_20_50_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-12-20T12_58_51_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-12-20T14_01_01_arena3'],\n",
       " 'virgin_mated24h': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-05T13_28_41_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-07T16_01_26_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-08T14_31_59_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-08T14_31_59_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-12T13_30_06_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-13T15_40_03_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-14T14_47_16_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-20T13_43_53_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-26T14_52_18_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-27T15_06_20_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-11T13_30_05_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-11T16_00_50_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-13T14_37_35_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-13T14_37_35_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-13T14_37_35_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-19T13_50_56_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-19T14_58_20_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-19T16_19_37_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-20T14_31_24_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-20T14_31_24_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-24T13_43_26_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-25T13_39_35_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-25T14_55_12_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-25T14_55_12_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-26T13_35_36_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-26T14_43_16_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-11-03T13_38_06_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-11-03T13_38_06_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-11-03T13_38_06_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-11-03T16_20_50_arena3'],\n",
       " 'virgin_mated2h': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-06T15_53_34_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-07T16_01_26_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-07T16_01_26_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-08T15_42_18_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-08T15_42_18_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-13T15_40_03_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-14T15_53_40_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-20T16_07_55_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-21T15_57_23_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-21T15_57_23_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-26T16_06_31_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-26T16_06_31_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-28T15_55_49_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-11T16_00_50_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-11T16_00_50_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-11T16_00_50_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-12T15_50_43_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-13T16_06_33_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-18T16_37_02_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-18T16_37_02_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-19T16_19_37_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-19T16_19_37_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-25T16_23_26_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-25T16_23_26_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-11-02T16_11_06_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-19T15_13_55_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-19T15_13_55_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-19T16_23_33_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-19T16_23_33_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-19T16_23_33_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-20T15_08_53_arena2']}"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Load all usable experiments for each condition.\n",
    "experiments = {condition: [] for condition in condition_order}\n",
    "\n",
    "for condition_path in conditions:\n",
    "    \n",
    "    condition = os.path.basename(condition_path)\n",
    "    print('\\t\\n', condition)\n",
    "    \n",
    "    for item in os.scandir(condition_path):\n",
    "        if item.is_dir() and item.name not in intruders:\n",
    "            \n",
    "            annotation_video = annotations.read(item.path.split('_slice')[0] + '.csv')\n",
    "            \n",
    "            try:\n",
    "                copulation = annotation_video[0].events[0]\n",
    "\n",
    "                # Filter out videos where copulation is interrupted.\n",
    "                copulation_end = copulation.time_interval[1]\n",
    "                if copulation_end==N_FRAMES:\n",
    "                    print('Copulation interrupted:', item.name)\n",
    "                    continue\n",
    "\n",
    "                # Filter out videos where copulation lasts less than 8 minutes.\n",
    "                copulation_duration = copulation.duration\n",
    "                if copulation_duration <= 8 * 60 * FPS:\n",
    "                    print('Copulation too short:', item.name)\n",
    "                    continue\n",
    "            \n",
    "            except IndexError as error:\n",
    "                continue\n",
    "\n",
    "            experiments[condition].append(item.path.split('_slice')[0])\n",
    "\n",
    "experiments"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Courtship Analysis"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "scrolled": true,
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Iteration:  0 \n",
      "Experiment: video_2017-09-05T13_28_41_arena4 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  1 \n",
      "Experiment: video_2017-09-05T14_34_55_arena2 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  2 \n",
      "Experiment: video_2017-09-06T13_42_13_arena1 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  3 \n",
      "Experiment: video_2017-09-06T14_45_32_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  4 \n",
      "Experiment: video_2017-09-07T14_37_38_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  5 \n",
      "Experiment: video_2017-09-07T14_37_38_arena4 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  6 \n",
      "Experiment: video_2017-09-08T13_26_13_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  7 \n",
      "Experiment: video_2017-09-12T13_30_06_arena4 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  8 \n",
      "Experiment: video_2017-09-12T14_36_55_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  9 \n",
      "Experiment: video_2017-09-12T16_18_15_arena4 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  10 \n",
      "Experiment: video_2017-09-13T14_34_18_arena2 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  11 \n",
      "Experiment: video_2017-09-20T13_43_53_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  12 \n",
      "Experiment: video_2017-09-20T14_48_55_arena2 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  13 \n",
      "Experiment: video_2017-09-21T13_38_55_arena4 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  14 \n",
      "Experiment: video_2017-09-21T15_57_23_arena2 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  15 \n",
      "Experiment: video_2017-09-26T13_40_19_arena1 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  16 \n",
      "Experiment: video_2017-09-28T13_36_06_arena4 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  17 \n",
      "Experiment: video_2017-09-28T14_44_01_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  18 \n",
      "Experiment: video_2017-09-28T15_55_49_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  19 \n",
      "Experiment: video_2017-10-12T15_50_43_arena2 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  20 \n",
      "Experiment: video_2017-10-13T16_06_33_arena2 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  21 \n",
      "Experiment: video_2017-10-18T15_19_17_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  22 \n",
      "Experiment: video_2017-10-19T13_50_56_arena2 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  23 \n",
      "Experiment: video_2017-10-20T13_21_06_arena2 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  24 \n",
      "Experiment: video_2017-10-20T15_44_09_arena2 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  25 \n",
      "Experiment: video_2017-10-24T16_13_35_arena4 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  26 \n",
      "Experiment: video_2017-10-25T14_55_12_arena1 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  27 \n",
      "Experiment: video_2017-11-02T13_37_48_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  28 \n",
      "Experiment: video_2017-11-02T14_48_28_arena4 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  29 \n",
      "Experiment: video_2017-11-02T16_11_06_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  30 \n",
      "Experiment: video_2017-11-03T14_54_45_arena1 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  31 \n",
      "Experiment: video_2017-11-03T16_20_50_arena4 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  32 \n",
      "Experiment: video_2017-12-20T12_58_51_arena4 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  33 \n",
      "Experiment: video_2017-12-20T14_01_01_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  0 \n",
      "Experiment: video_2017-09-05T13_28_41_arena3 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  1 \n",
      "Experiment: video_2017-09-07T16_01_26_arena4 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  2 \n",
      "Experiment: video_2017-09-08T14_31_59_arena2 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  3 \n",
      "Experiment: video_2017-09-08T14_31_59_arena3 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  4 \n",
      "Experiment: video_2017-09-12T13_30_06_arena1 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  5 \n",
      "Experiment: video_2017-09-13T15_40_03_arena1 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  6 \n",
      "Experiment: video_2017-09-14T14_47_16_arena4 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  7 \n",
      "Experiment: video_2017-09-20T13_43_53_arena1 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  8 \n",
      "Experiment: video_2017-09-26T14_52_18_arena2 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  9 \n",
      "Experiment: video_2017-09-27T15_06_20_arena3 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  10 \n",
      "Experiment: video_2017-10-11T13_30_05_arena1 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  11 \n",
      "Experiment: video_2017-10-11T16_00_50_arena4 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  12 \n",
      "Experiment: video_2017-10-13T14_37_35_arena1 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  13 \n",
      "Experiment: video_2017-10-13T14_37_35_arena2 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  14 \n",
      "Experiment: video_2017-10-13T14_37_35_arena3 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  15 \n",
      "Experiment: video_2017-10-19T13_50_56_arena4 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  16 \n",
      "Experiment: video_2017-10-19T14_58_20_arena3 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  17 \n",
      "Experiment: video_2017-10-19T16_19_37_arena2 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  18 \n",
      "Experiment: video_2017-10-20T14_31_24_arena3 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  19 \n",
      "Experiment: video_2017-10-20T14_31_24_arena4 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  20 \n",
      "Experiment: video_2017-10-24T13_43_26_arena3 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  21 \n",
      "Experiment: video_2017-10-25T13_39_35_arena1 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  22 \n",
      "Experiment: video_2017-10-25T14_55_12_arena2 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  23 \n",
      "Experiment: video_2017-10-25T14_55_12_arena3 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  24 \n",
      "Experiment: video_2017-10-26T13_35_36_arena2 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  25 \n",
      "Experiment: video_2017-10-26T14_43_16_arena3 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  26 \n",
      "Experiment: video_2017-11-03T13_38_06_arena2 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  27 \n",
      "Experiment: video_2017-11-03T13_38_06_arena3 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  28 \n",
      "Experiment: video_2017-11-03T13_38_06_arena4 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  29 \n",
      "Experiment: video_2017-11-03T16_20_50_arena3 \n",
      "Condition:  virgin_mated24h \n",
      "\n",
      "Iteration:  0 \n",
      "Experiment: video_2017-09-06T15_53_34_arena1 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  1 \n",
      "Experiment: video_2017-09-07T16_01_26_arena1 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  2 \n",
      "Experiment: video_2017-09-07T16_01_26_arena2 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  3 \n",
      "Experiment: video_2017-09-08T15_42_18_arena1 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  4 \n",
      "Experiment: video_2017-09-08T15_42_18_arena3 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  5 \n",
      "Experiment: video_2017-09-13T15_40_03_arena4 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  6 \n",
      "Experiment: video_2017-09-14T15_53_40_arena3 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  7 \n",
      "Experiment: video_2017-09-20T16_07_55_arena4 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  8 \n",
      "Experiment: video_2017-09-21T15_57_23_arena1 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  9 \n",
      "Experiment: video_2017-09-21T15_57_23_arena4 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  10 \n",
      "Experiment: video_2017-09-26T16_06_31_arena1 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  11 \n",
      "Experiment: video_2017-09-26T16_06_31_arena3 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  12 \n",
      "Experiment: video_2017-09-28T15_55_49_arena1 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  13 \n",
      "Experiment: video_2017-10-11T16_00_50_arena1 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  14 \n",
      "Experiment: video_2017-10-11T16_00_50_arena2 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  15 \n",
      "Experiment: video_2017-10-11T16_00_50_arena3 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  16 \n",
      "Experiment: video_2017-10-12T15_50_43_arena4 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  17 \n",
      "Experiment: video_2017-10-13T16_06_33_arena4 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  18 \n",
      "Experiment: video_2017-10-18T16_37_02_arena3 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  19 \n",
      "Experiment: video_2017-10-18T16_37_02_arena4 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  20 \n",
      "Experiment: video_2017-10-19T16_19_37_arena1 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  21 \n",
      "Experiment: video_2017-10-19T16_19_37_arena4 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  22 \n",
      "Experiment: video_2017-10-25T16_23_26_arena1 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  23 \n",
      "Experiment: video_2017-10-25T16_23_26_arena3 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  24 \n",
      "Experiment: video_2017-11-02T16_11_06_arena4 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  25 \n",
      "Experiment: video_2017-12-19T15_13_55_arena2 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  26 \n",
      "Experiment: video_2017-12-19T15_13_55_arena3 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  27 \n",
      "Experiment: video_2017-12-19T16_23_33_arena1 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  28 \n",
      "Experiment: video_2017-12-19T16_23_33_arena2 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  29 \n",
      "Experiment: video_2017-12-19T16_23_33_arena3 \n",
      "Condition:  virgin_mated2h \n",
      "\n",
      "Iteration:  30 \n",
      "Experiment: video_2017-12-20T15_08_53_arena2 \n",
      "Condition:  virgin_mated2h \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>has_cop</th>\n",
       "      <th>latency</th>\n",
       "      <th>latency_mins</th>\n",
       "      <th>duration</th>\n",
       "      <th>duration_mins</th>\n",
       "      <th>has_second_cop</th>\n",
       "      <th>latency_to_second_cop</th>\n",
       "      <th>latency_to_second_cop_mins</th>\n",
       "      <th>second_cop_duration</th>\n",
       "      <th>second_cop_duration_mins</th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>True</td>\n",
       "      <td>31281</td>\n",
       "      <td>8.689167</td>\n",
       "      <td>42083</td>\n",
       "      <td>11.689722</td>\n",
       "      <td>True</td>\n",
       "      <td>47506.0</td>\n",
       "      <td>13.196111</td>\n",
       "      <td>47739.0</td>\n",
       "      <td>13.260833</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>True</td>\n",
       "      <td>33032</td>\n",
       "      <td>9.175556</td>\n",
       "      <td>54966</td>\n",
       "      <td>15.268333</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T14_34_55_arena2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>True</td>\n",
       "      <td>18402</td>\n",
       "      <td>5.111667</td>\n",
       "      <td>37771</td>\n",
       "      <td>10.491944</td>\n",
       "      <td>True</td>\n",
       "      <td>29708.0</td>\n",
       "      <td>8.252222</td>\n",
       "      <td>52471.0</td>\n",
       "      <td>14.575278</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T13_42_13_arena1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>True</td>\n",
       "      <td>1744</td>\n",
       "      <td>0.484444</td>\n",
       "      <td>51519</td>\n",
       "      <td>14.310833</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T14_45_32_arena3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>True</td>\n",
       "      <td>115813</td>\n",
       "      <td>32.170278</td>\n",
       "      <td>46945</td>\n",
       "      <td>13.040278</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-07T14_37_38_arena3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>90</th>\n",
       "      <td>True</td>\n",
       "      <td>17109</td>\n",
       "      <td>4.752500</td>\n",
       "      <td>47898</td>\n",
       "      <td>13.305000</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_mated2h</td>\n",
       "      <td>video_2017-12-19T15_13_55_arena3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91</th>\n",
       "      <td>True</td>\n",
       "      <td>12412</td>\n",
       "      <td>3.447778</td>\n",
       "      <td>45036</td>\n",
       "      <td>12.510000</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_mated2h</td>\n",
       "      <td>video_2017-12-19T16_23_33_arena1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92</th>\n",
       "      <td>True</td>\n",
       "      <td>148503</td>\n",
       "      <td>41.250833</td>\n",
       "      <td>39500</td>\n",
       "      <td>10.972222</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_mated2h</td>\n",
       "      <td>video_2017-12-19T16_23_33_arena2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>93</th>\n",
       "      <td>True</td>\n",
       "      <td>19470</td>\n",
       "      <td>5.408333</td>\n",
       "      <td>47651</td>\n",
       "      <td>13.236389</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_mated2h</td>\n",
       "      <td>video_2017-12-19T16_23_33_arena3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>94</th>\n",
       "      <td>True</td>\n",
       "      <td>39652</td>\n",
       "      <td>11.014444</td>\n",
       "      <td>56871</td>\n",
       "      <td>15.797500</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_mated2h</td>\n",
       "      <td>video_2017-12-20T15_08_53_arena2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>95 rows × 13 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    has_cop  latency  latency_mins  duration  duration_mins  has_second_cop  \\\n",
       "0      True    31281      8.689167     42083      11.689722            True   \n",
       "1      True    33032      9.175556     54966      15.268333           False   \n",
       "2      True    18402      5.111667     37771      10.491944            True   \n",
       "3      True     1744      0.484444     51519      14.310833           False   \n",
       "4      True   115813     32.170278     46945      13.040278           False   \n",
       "..      ...      ...           ...       ...            ...             ...   \n",
       "90     True    17109      4.752500     47898      13.305000           False   \n",
       "91     True    12412      3.447778     45036      12.510000           False   \n",
       "92     True   148503     41.250833     39500      10.972222           False   \n",
       "93     True    19470      5.408333     47651      13.236389           False   \n",
       "94     True    39652     11.014444     56871      15.797500           False   \n",
       "\n",
       "    latency_to_second_cop  latency_to_second_cop_mins  second_cop_duration  \\\n",
       "0                 47506.0                   13.196111              47739.0   \n",
       "1                     NaN                         NaN                  NaN   \n",
       "2                 29708.0                    8.252222              52471.0   \n",
       "3                     NaN                         NaN                  NaN   \n",
       "4                     NaN                         NaN                  NaN   \n",
       "..                    ...                         ...                  ...   \n",
       "90                    NaN                         NaN                  NaN   \n",
       "91                    NaN                         NaN                  NaN   \n",
       "92                    NaN                         NaN                  NaN   \n",
       "93                    NaN                         NaN                  NaN   \n",
       "94                    NaN                         NaN                  NaN   \n",
       "\n",
       "    second_cop_duration_mins  has_aggression       condition  \\\n",
       "0                  13.260833            True   virgin_virgin   \n",
       "1                        NaN            True   virgin_virgin   \n",
       "2                  14.575278            True   virgin_virgin   \n",
       "3                        NaN            True   virgin_virgin   \n",
       "4                        NaN            True   virgin_virgin   \n",
       "..                       ...             ...             ...   \n",
       "90                       NaN            True  virgin_mated2h   \n",
       "91                       NaN            True  virgin_mated2h   \n",
       "92                       NaN            True  virgin_mated2h   \n",
       "93                       NaN            True  virgin_mated2h   \n",
       "94                       NaN            True  virgin_mated2h   \n",
       "\n",
       "                          experiment  \n",
       "0   video_2017-09-05T13_28_41_arena4  \n",
       "1   video_2017-09-05T14_34_55_arena2  \n",
       "2   video_2017-09-06T13_42_13_arena1  \n",
       "3   video_2017-09-06T14_45_32_arena3  \n",
       "4   video_2017-09-07T14_37_38_arena3  \n",
       "..                               ...  \n",
       "90  video_2017-12-19T15_13_55_arena3  \n",
       "91  video_2017-12-19T16_23_33_arena1  \n",
       "92  video_2017-12-19T16_23_33_arena2  \n",
       "93  video_2017-12-19T16_23_33_arena3  \n",
       "94  video_2017-12-20T15_08_53_arena2  \n",
       "\n",
       "[95 rows x 13 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Generate DataFrame for copulation data.\n",
    "copulation_df = pd.DataFrame()\n",
    "for condition in experiments.keys():\n",
    "    for h, experiment in enumerate(experiments[condition]):\n",
    "\n",
    "        experiment_path = experiment\n",
    "        experiment_name = os.path.basename(experiment)\n",
    "        \n",
    "        print('Iteration: ', h, '\\nExperiment:', experiment_name, '\\nCondition: ', condition, '\\n')\n",
    "\n",
    "        annotation_video = annotations.read(experiment_path+'.csv')\n",
    "        copulation_events = annotation_video[0].events\n",
    "        n_copulations = len(copulation_events)\n",
    "        \n",
    "        aggression_events = annotation_video[1].events\n",
    "\n",
    "        if n_copulations==0:\n",
    "            copulation_data = pd.DataFrame({'has_cop': False,\n",
    "                                            'latency': np.nan,\n",
    "                                            'latency_mins': np.nan,\n",
    "                                            'duration': np.nan,\n",
    "                                            'duration_mins': np.nan,\n",
    "                                            'has_second_cop': False,\n",
    "                                            'latency_to_second_cop': np.nan,\n",
    "                                            'latency_to_second_cop_mins': np.nan,\n",
    "                                            'second_cop_duration': np.nan,\n",
    "                                            'second_cop_duration_mins': np.nan,\n",
    "                                            'has_aggression': False,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment_name},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        if n_copulations==1:\n",
    "            first_courtship_event = helpers.load_JAABA_behavior(annotation_video, condition, 'courtship', experiment_path)\n",
    "            copulation_data = pd.DataFrame({'has_cop': True,\n",
    "                                            'latency':  copulation_events[0].time - first_courtship_event,\n",
    "                                            'latency_mins': (copulation_events[0].time - first_courtship_event) / (60 * FPS),\n",
    "                                            'duration': copulation_events[0].duration,\n",
    "                                            'duration_mins': copulation_events[0].duration / (60 * FPS),\n",
    "                                            'has_second_cop': False,\n",
    "                                            'latency_to_second_cop': np.nan,\n",
    "                                            'latency_to_second_cop_mins': np.nan,\n",
    "                                            'second_cop_duration': np.nan,\n",
    "                                            'second_cop_duration_mins': np.nan,\n",
    "                                            'has_aggression': False if len(aggression_events) == 0 else True,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment_name},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        if n_copulations==2:\n",
    "            first_courtship_event, second_courtship_event = helpers.load_JAABA_behavior(annotation_video, condition, 'courtship', experiment_path)\n",
    "            second_cop_start = copulation_events[1].time\n",
    "            latency_to_second_cop = second_cop_start - second_courtship_event\n",
    "            copulation_data = pd.DataFrame({'has_cop': True,\n",
    "                                            'latency': copulation_events[0].time - first_courtship_event,\n",
    "                                            'latency_mins': (copulation_events[0].time - first_courtship_event) / (60 * FPS),\n",
    "                                            'duration': copulation_events[0].duration,\n",
    "                                            'duration_mins': copulation_events[0].duration / (60 * FPS),\n",
    "                                            'has_second_cop': True,\n",
    "                                            'latency_to_second_cop': latency_to_second_cop,\n",
    "                                            'latency_to_second_cop_mins': latency_to_second_cop / (60 * FPS),\n",
    "                                            'second_cop_duration': copulation_events[1].duration,\n",
    "                                            'second_cop_duration_mins':copulation_events[1].duration / (60 * FPS),\n",
    "                                            'has_aggression': False if len(aggression_events) == 0 else True,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment_name},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        copulation_df = pd.concat([copulation_df, copulation_data], ignore_index=True)\n",
    "\n",
    "copulation_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>has_cop</th>\n",
       "      <th>latency</th>\n",
       "      <th>latency_mins</th>\n",
       "      <th>duration</th>\n",
       "      <th>duration_mins</th>\n",
       "      <th>has_second_cop</th>\n",
       "      <th>latency_to_second_cop</th>\n",
       "      <th>latency_to_second_cop_mins</th>\n",
       "      <th>second_cop_duration</th>\n",
       "      <th>second_cop_duration_mins</th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>True</td>\n",
       "      <td>31281</td>\n",
       "      <td>8.689167</td>\n",
       "      <td>42083</td>\n",
       "      <td>11.689722</td>\n",
       "      <td>True</td>\n",
       "      <td>47506.0</td>\n",
       "      <td>13.196111</td>\n",
       "      <td>47739.0</td>\n",
       "      <td>13.260833</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>True</td>\n",
       "      <td>33032</td>\n",
       "      <td>9.175556</td>\n",
       "      <td>54966</td>\n",
       "      <td>15.268333</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T14_34_55_arena2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>True</td>\n",
       "      <td>18402</td>\n",
       "      <td>5.111667</td>\n",
       "      <td>37771</td>\n",
       "      <td>10.491944</td>\n",
       "      <td>True</td>\n",
       "      <td>29708.0</td>\n",
       "      <td>8.252222</td>\n",
       "      <td>52471.0</td>\n",
       "      <td>14.575278</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T13_42_13_arena1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>True</td>\n",
       "      <td>1744</td>\n",
       "      <td>0.484444</td>\n",
       "      <td>51519</td>\n",
       "      <td>14.310833</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T14_45_32_arena3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>True</td>\n",
       "      <td>115813</td>\n",
       "      <td>32.170278</td>\n",
       "      <td>46945</td>\n",
       "      <td>13.040278</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-07T14_37_38_arena3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   has_cop  latency  latency_mins  duration  duration_mins  has_second_cop  \\\n",
       "0     True    31281      8.689167     42083      11.689722            True   \n",
       "1     True    33032      9.175556     54966      15.268333           False   \n",
       "2     True    18402      5.111667     37771      10.491944            True   \n",
       "3     True     1744      0.484444     51519      14.310833           False   \n",
       "4     True   115813     32.170278     46945      13.040278           False   \n",
       "\n",
       "   latency_to_second_cop  latency_to_second_cop_mins  second_cop_duration  \\\n",
       "0                47506.0                   13.196111              47739.0   \n",
       "1                    NaN                         NaN                  NaN   \n",
       "2                29708.0                    8.252222              52471.0   \n",
       "3                    NaN                         NaN                  NaN   \n",
       "4                    NaN                         NaN                  NaN   \n",
       "\n",
       "   second_cop_duration_mins  has_aggression      condition  \\\n",
       "0                 13.260833            True  virgin_virgin   \n",
       "1                       NaN            True  virgin_virgin   \n",
       "2                 14.575278            True  virgin_virgin   \n",
       "3                       NaN            True  virgin_virgin   \n",
       "4                       NaN            True  virgin_virgin   \n",
       "\n",
       "                         experiment  \n",
       "0  video_2017-09-05T13_28_41_arena4  \n",
       "1  video_2017-09-05T14_34_55_arena2  \n",
       "2  video_2017-09-06T13_42_13_arena1  \n",
       "3  video_2017-09-06T14_45_32_arena3  \n",
       "4  video_2017-09-07T14_37_38_arena3  "
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Fix negative latency to copulation.\n",
    "shortest_latency = copulation_df.query('latency>=0')['latency'].min()\n",
    "copulation_df['latency'] = copulation_df['latency'].apply(lambda x: x if x >= 0 else shortest_latency)\n",
    "\n",
    "# Fix negative latency to copulation in minutes.\n",
    "shortest_latency_mins = copulation_df.query('latency_mins>=0')['latency_mins'].min()\n",
    "copulation_df['latency_mins'] = copulation_df['latency_mins'].apply(lambda x: x if x >= 0 else shortest_latency_mins)\n",
    "\n",
    "copulation_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'virgin_virgin': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-05T13_28_41_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-05T14_34_55_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-06T13_42_13_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-06T14_45_32_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-07T14_37_38_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-07T14_37_38_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-08T13_26_13_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-12T13_30_06_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-12T14_36_55_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-12T16_18_15_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-13T14_34_18_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-20T13_43_53_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-20T14_48_55_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-21T13_38_55_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-21T15_57_23_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-26T13_40_19_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-28T13_36_06_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-28T14_44_01_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-28T15_55_49_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-12T15_50_43_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-13T16_06_33_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-18T15_19_17_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-19T13_50_56_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-20T13_21_06_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-20T15_44_09_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-24T16_13_35_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-25T14_55_12_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-02T13_37_48_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-02T14_48_28_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-02T16_11_06_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-03T14_54_45_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-03T16_20_50_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-12-20T12_58_51_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-12-20T14_01_01_arena3'],\n",
       " 'virgin_mated24h': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-05T13_28_41_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-07T16_01_26_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-08T14_31_59_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-08T14_31_59_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-12T13_30_06_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-13T15_40_03_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-14T14_47_16_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-20T13_43_53_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-26T14_52_18_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-27T15_06_20_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-11T13_30_05_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-11T16_00_50_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-13T14_37_35_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-13T14_37_35_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-13T14_37_35_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-19T13_50_56_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-19T14_58_20_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-19T16_19_37_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-20T14_31_24_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-20T14_31_24_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-24T13_43_26_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-25T13_39_35_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-25T14_55_12_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-25T14_55_12_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-26T13_35_36_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-26T14_43_16_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-11-03T13_38_06_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-11-03T13_38_06_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-11-03T13_38_06_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-11-03T16_20_50_arena3'],\n",
       " 'virgin_mated2h': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-06T15_53_34_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-07T16_01_26_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-07T16_01_26_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-08T15_42_18_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-08T15_42_18_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-13T15_40_03_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-14T15_53_40_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-20T16_07_55_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-21T15_57_23_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-21T15_57_23_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-26T16_06_31_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-26T16_06_31_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-28T15_55_49_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-11T16_00_50_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-11T16_00_50_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-11T16_00_50_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-12T15_50_43_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-13T16_06_33_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-18T16_37_02_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-18T16_37_02_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-19T16_19_37_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-19T16_19_37_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-25T16_23_26_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-25T16_23_26_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-11-02T16_11_06_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-19T15_13_55_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-19T15_13_55_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-19T16_23_33_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-19T16_23_33_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-19T16_23_33_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-20T15_08_53_arena2']}"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "experiments_with_cop = {}\n",
    "for condition in condition_order:\n",
    "    current_condition = copulation_df[copulation_df['condition']==condition]\n",
    "    has_cop = current_condition['experiment'][current_condition['has_cop']==True]\n",
    "    has_cop = [os.path.join(EXPERIMENTS_PATH, condition, exp) for exp in has_cop.values]\n",
    "    experiments_with_cop.update({condition: has_cop})\n",
    "\n",
    "experiments_with_cop"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "scrolled": true,
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\t virgin_virgin \n",
      "\n",
      "Iteration: 0 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-09-05T13_28_41_arena4 \n",
      "\n",
      "Iteration: 1 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-09-05T14_34_55_arena2 \n",
      "\n",
      "Iteration: 2 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-09-06T13_42_13_arena1 \n",
      "\n",
      "Iteration: 3 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-09-06T14_45_32_arena3 \n",
      "\n",
      "Iteration: 4 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-09-07T14_37_38_arena3 \n",
      "\n",
      "Iteration: 5 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-09-07T14_37_38_arena4 \n",
      "\n",
      "Iteration: 6 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-09-08T13_26_13_arena3 \n",
      "\n",
      "Iteration: 7 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-09-12T13_30_06_arena4 \n",
      "\n",
      "Iteration: 8 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-09-12T14_36_55_arena3 \n",
      "\n",
      "Iteration: 9 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-09-12T16_18_15_arena4 \n",
      "\n",
      "Iteration: 10 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-09-13T14_34_18_arena2 \n",
      "\n",
      "Iteration: 11 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-09-20T13_43_53_arena3 \n",
      "\n",
      "Iteration: 12 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-09-20T14_48_55_arena2 \n",
      "\n",
      "Iteration: 13 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-09-21T13_38_55_arena4 \n",
      "\n",
      "Iteration: 14 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-09-21T15_57_23_arena2 \n",
      "\n",
      "Iteration: 15 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-09-26T13_40_19_arena1 \n",
      "\n",
      "Iteration: 16 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-09-28T13_36_06_arena4 \n",
      "\n",
      "Iteration: 17 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-09-28T14_44_01_arena3 \n",
      "\n",
      "Iteration: 18 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-09-28T15_55_49_arena3 \n",
      "\n",
      "Iteration: 19 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-10-12T15_50_43_arena2 \n",
      "\n",
      "Iteration: 20 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-10-13T16_06_33_arena2 \n",
      "\n",
      "Iteration: 21 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-10-18T15_19_17_arena3 \n",
      "\n",
      "Iteration: 22 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-10-19T13_50_56_arena2 \n",
      "\n",
      "Iteration: 23 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-10-20T13_21_06_arena2 \n",
      "\n",
      "Iteration: 24 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-10-20T15_44_09_arena2 \n",
      "\n",
      "Iteration: 25 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-10-24T16_13_35_arena4 \n",
      "\n",
      "Iteration: 26 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-10-25T14_55_12_arena1 \n",
      "\n",
      "Iteration: 27 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-11-02T13_37_48_arena3 \n",
      "\n",
      "Iteration: 28 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-11-02T14_48_28_arena4 \n",
      "\n",
      "Iteration: 29 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-11-02T16_11_06_arena3 \n",
      "\n",
      "Iteration: 30 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-11-03T14_54_45_arena1 \n",
      "\n",
      "Iteration: 31 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-11-03T16_20_50_arena4 \n",
      "\n",
      "Iteration: 32 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-12-20T12_58_51_arena4 \n",
      "\n",
      "Iteration: 33 \n",
      "Condition: virgin_virgin \n",
      "Experiment: video_2017-12-20T14_01_01_arena3 \n",
      "\n",
      "\n",
      "\t virgin_mated24h \n",
      "\n",
      "Iteration: 0 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-09-05T13_28_41_arena3 \n",
      "\n",
      "Iteration: 1 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-09-07T16_01_26_arena4 \n",
      "\n",
      "Iteration: 2 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-09-08T14_31_59_arena2 \n",
      "\n",
      "Iteration: 3 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-09-08T14_31_59_arena3 \n",
      "\n",
      "Iteration: 4 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-09-12T13_30_06_arena1 \n",
      "\n",
      "Iteration: 5 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-09-13T15_40_03_arena1 \n",
      "\n",
      "Iteration: 6 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-09-14T14_47_16_arena4 \n",
      "\n",
      "Iteration: 7 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-09-20T13_43_53_arena1 \n",
      "\n",
      "Iteration: 8 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-09-26T14_52_18_arena2 \n",
      "\n",
      "Iteration: 9 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-09-27T15_06_20_arena3 \n",
      "\n",
      "Iteration: 10 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-10-11T13_30_05_arena1 \n",
      "\n",
      "Iteration: 11 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-10-11T16_00_50_arena4 \n",
      "\n",
      "Iteration: 12 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-10-13T14_37_35_arena1 \n",
      "\n",
      "Iteration: 13 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-10-13T14_37_35_arena2 \n",
      "\n",
      "Iteration: 14 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-10-13T14_37_35_arena3 \n",
      "\n",
      "Iteration: 15 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-10-19T13_50_56_arena4 \n",
      "\n",
      "Iteration: 16 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-10-19T14_58_20_arena3 \n",
      "\n",
      "Iteration: 17 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-10-19T16_19_37_arena2 \n",
      "\n",
      "Iteration: 18 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-10-20T14_31_24_arena3 \n",
      "\n",
      "Iteration: 19 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-10-20T14_31_24_arena4 \n",
      "\n",
      "Iteration: 20 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-10-24T13_43_26_arena3 \n",
      "\n",
      "Iteration: 21 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-10-25T13_39_35_arena1 \n",
      "\n",
      "Iteration: 22 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-10-25T14_55_12_arena2 \n",
      "\n",
      "Iteration: 23 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-10-25T14_55_12_arena3 \n",
      "\n",
      "Iteration: 24 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-10-26T13_35_36_arena2 \n",
      "\n",
      "Iteration: 25 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-10-26T14_43_16_arena3 \n",
      "\n",
      "Iteration: 26 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-11-03T13_38_06_arena2 \n",
      "\n",
      "Iteration: 27 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-11-03T13_38_06_arena3 \n",
      "\n",
      "Iteration: 28 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-11-03T13_38_06_arena4 \n",
      "\n",
      "Iteration: 29 \n",
      "Condition: virgin_mated24h \n",
      "Experiment: video_2017-11-03T16_20_50_arena3 \n",
      "\n",
      "\n",
      "\t virgin_mated2h \n",
      "\n",
      "Iteration: 0 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-09-06T15_53_34_arena1 \n",
      "\n",
      "Iteration: 1 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-09-07T16_01_26_arena1 \n",
      "\n",
      "Iteration: 2 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-09-07T16_01_26_arena2 \n",
      "\n",
      "Iteration: 3 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-09-08T15_42_18_arena1 \n",
      "\n",
      "Iteration: 4 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-09-08T15_42_18_arena3 \n",
      "\n",
      "Iteration: 5 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-09-13T15_40_03_arena4 \n",
      "\n",
      "Iteration: 6 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-09-14T15_53_40_arena3 \n",
      "\n",
      "Iteration: 7 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-09-20T16_07_55_arena4 \n",
      "\n",
      "Iteration: 8 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-09-21T15_57_23_arena1 \n",
      "\n",
      "Iteration: 9 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-09-21T15_57_23_arena4 \n",
      "\n",
      "Iteration: 10 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-09-26T16_06_31_arena1 \n",
      "\n",
      "Iteration: 11 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-09-26T16_06_31_arena3 \n",
      "\n",
      "Iteration: 12 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-09-28T15_55_49_arena1 \n",
      "\n",
      "Iteration: 13 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-10-11T16_00_50_arena1 \n",
      "\n",
      "Iteration: 14 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-10-11T16_00_50_arena2 \n",
      "\n",
      "Iteration: 15 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-10-11T16_00_50_arena3 \n",
      "\n",
      "Iteration: 16 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-10-12T15_50_43_arena4 \n",
      "\n",
      "Iteration: 17 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-10-13T16_06_33_arena4 \n",
      "\n",
      "Iteration: 18 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-10-18T16_37_02_arena3 \n",
      "\n",
      "Iteration: 19 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-10-18T16_37_02_arena4 \n",
      "\n",
      "Iteration: 20 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-10-19T16_19_37_arena1 \n",
      "\n",
      "Iteration: 21 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-10-19T16_19_37_arena4 \n",
      "\n",
      "Iteration: 22 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-10-25T16_23_26_arena1 \n",
      "\n",
      "Iteration: 23 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-10-25T16_23_26_arena3 \n",
      "\n",
      "Iteration: 24 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-11-02T16_11_06_arena4 \n",
      "\n",
      "Iteration: 25 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-12-19T15_13_55_arena2 \n",
      "\n",
      "Iteration: 26 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-12-19T15_13_55_arena3 \n",
      "\n",
      "Iteration: 27 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-12-19T16_23_33_arena1 \n",
      "\n",
      "Iteration: 28 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-12-19T16_23_33_arena2 \n",
      "\n",
      "Iteration: 29 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-12-19T16_23_33_arena3 \n",
      "\n",
      "Iteration: 30 \n",
      "Condition: virgin_mated2h \n",
      "Experiment: video_2017-12-20T15_08_53_arena2 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>nbouts</th>\n",
       "      <th>nframes</th>\n",
       "      <th>ratio_bouts</th>\n",
       "      <th>ratio_frames</th>\n",
       "      <th>latency</th>\n",
       "      <th>latency_mins</th>\n",
       "      <th>fly_id</th>\n",
       "      <th>cop_id</th>\n",
       "      <th>experiment</th>\n",
       "      <th>condition</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>23</td>\n",
       "      <td>15551</td>\n",
       "      <td>0.000735</td>\n",
       "      <td>0.497155</td>\n",
       "      <td>1838</td>\n",
       "      <td>0.510556</td>\n",
       "      <td>1</td>\n",
       "      <td>copulated</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4</td>\n",
       "      <td>virgin_virgin</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>25</td>\n",
       "      <td>9450</td>\n",
       "      <td>0.000811</td>\n",
       "      <td>0.306649</td>\n",
       "      <td>2301</td>\n",
       "      <td>0.639167</td>\n",
       "      <td>2</td>\n",
       "      <td>not_copulated</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4</td>\n",
       "      <td>virgin_virgin</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>19</td>\n",
       "      <td>14542</td>\n",
       "      <td>0.000591</td>\n",
       "      <td>0.452359</td>\n",
       "      <td>3762</td>\n",
       "      <td>1.045000</td>\n",
       "      <td>1</td>\n",
       "      <td>not_copulated</td>\n",
       "      <td>video_2017-09-05T14_34_55_arena2</td>\n",
       "      <td>virgin_virgin</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>25</td>\n",
       "      <td>15850</td>\n",
       "      <td>0.000757</td>\n",
       "      <td>0.479852</td>\n",
       "      <td>2878</td>\n",
       "      <td>0.799444</td>\n",
       "      <td>2</td>\n",
       "      <td>copulated</td>\n",
       "      <td>video_2017-09-05T14_34_55_arena2</td>\n",
       "      <td>virgin_virgin</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>13</td>\n",
       "      <td>10119</td>\n",
       "      <td>0.000706</td>\n",
       "      <td>0.549916</td>\n",
       "      <td>2236</td>\n",
       "      <td>0.621111</td>\n",
       "      <td>1</td>\n",
       "      <td>copulated</td>\n",
       "      <td>video_2017-09-06T13_42_13_arena1</td>\n",
       "      <td>virgin_virgin</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>185</th>\n",
       "      <td>100</td>\n",
       "      <td>90685</td>\n",
       "      <td>0.000668</td>\n",
       "      <td>0.605366</td>\n",
       "      <td>676</td>\n",
       "      <td>0.187778</td>\n",
       "      <td>2</td>\n",
       "      <td>not_copulated</td>\n",
       "      <td>video_2017-12-19T16_23_33_arena2</td>\n",
       "      <td>virgin_mated2h</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>186</th>\n",
       "      <td>9</td>\n",
       "      <td>9467</td>\n",
       "      <td>0.000462</td>\n",
       "      <td>0.486260</td>\n",
       "      <td>5513</td>\n",
       "      <td>1.531389</td>\n",
       "      <td>1</td>\n",
       "      <td>copulated</td>\n",
       "      <td>video_2017-12-19T16_23_33_arena3</td>\n",
       "      <td>virgin_mated2h</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>187</th>\n",
       "      <td>11</td>\n",
       "      <td>11088</td>\n",
       "      <td>0.000451</td>\n",
       "      <td>0.455098</td>\n",
       "      <td>618</td>\n",
       "      <td>0.171667</td>\n",
       "      <td>2</td>\n",
       "      <td>not_copulated</td>\n",
       "      <td>video_2017-12-19T16_23_33_arena3</td>\n",
       "      <td>virgin_mated2h</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>188</th>\n",
       "      <td>17</td>\n",
       "      <td>16489</td>\n",
       "      <td>0.000429</td>\n",
       "      <td>0.415853</td>\n",
       "      <td>3940</td>\n",
       "      <td>1.094444</td>\n",
       "      <td>1</td>\n",
       "      <td>copulated</td>\n",
       "      <td>video_2017-12-20T15_08_53_arena2</td>\n",
       "      <td>virgin_mated2h</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>189</th>\n",
       "      <td>13</td>\n",
       "      <td>695</td>\n",
       "      <td>0.000396</td>\n",
       "      <td>0.021164</td>\n",
       "      <td>10752</td>\n",
       "      <td>2.986667</td>\n",
       "      <td>2</td>\n",
       "      <td>not_copulated</td>\n",
       "      <td>video_2017-12-20T15_08_53_arena2</td>\n",
       "      <td>virgin_mated2h</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>190 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     nbouts  nframes  ratio_bouts  ratio_frames  latency  latency_mins fly_id  \\\n",
       "0        23    15551     0.000735      0.497155     1838      0.510556      1   \n",
       "1        25     9450     0.000811      0.306649     2301      0.639167      2   \n",
       "2        19    14542     0.000591      0.452359     3762      1.045000      1   \n",
       "3        25    15850     0.000757      0.479852     2878      0.799444      2   \n",
       "4        13    10119     0.000706      0.549916     2236      0.621111      1   \n",
       "..      ...      ...          ...           ...      ...           ...    ...   \n",
       "185     100    90685     0.000668      0.605366      676      0.187778      2   \n",
       "186       9     9467     0.000462      0.486260     5513      1.531389      1   \n",
       "187      11    11088     0.000451      0.455098      618      0.171667      2   \n",
       "188      17    16489     0.000429      0.415853     3940      1.094444      1   \n",
       "189      13      695     0.000396      0.021164    10752      2.986667      2   \n",
       "\n",
       "            cop_id                        experiment       condition  \n",
       "0        copulated  video_2017-09-05T13_28_41_arena4   virgin_virgin  \n",
       "1    not_copulated  video_2017-09-05T13_28_41_arena4   virgin_virgin  \n",
       "2    not_copulated  video_2017-09-05T14_34_55_arena2   virgin_virgin  \n",
       "3        copulated  video_2017-09-05T14_34_55_arena2   virgin_virgin  \n",
       "4        copulated  video_2017-09-06T13_42_13_arena1   virgin_virgin  \n",
       "..             ...                               ...             ...  \n",
       "185  not_copulated  video_2017-12-19T16_23_33_arena2  virgin_mated2h  \n",
       "186      copulated  video_2017-12-19T16_23_33_arena3  virgin_mated2h  \n",
       "187  not_copulated  video_2017-12-19T16_23_33_arena3  virgin_mated2h  \n",
       "188      copulated  video_2017-12-20T15_08_53_arena2  virgin_mated2h  \n",
       "189  not_copulated  video_2017-12-20T15_08_53_arena2  virgin_mated2h  \n",
       "\n",
       "[190 rows x 10 columns]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "courtship_df = pd.DataFrame()\n",
    "for condition in condition_order:\n",
    "    \n",
    "    print('\\n\\t', condition, '\\n')\n",
    "    \n",
    "    n_experiments = len(experiments_with_cop[condition])\n",
    "    \n",
    "    for h, experiment in enumerate(experiments_with_cop[condition]):\n",
    "\n",
    "        experiment_path = experiment\n",
    "        experiment_name = os.path.basename(experiment)\n",
    "        \n",
    "        print('Iteration:', h, '\\nCondition:', condition, '\\nExperiment:', experiment_name, '\\n')\n",
    "\n",
    "        annotation_video = annotations.read(experiment_path + '.csv')\n",
    "        copulation_time =  annotation_video[0].events[0].time\n",
    "        comment = annotation_video[0].events[0].comment\n",
    "\n",
    "        courtship_fly1 = helpers.read_behavior_predictions(experiment_path, 0, 'courtship_1_2')\n",
    "        courtship_fly2 = helpers.read_behavior_predictions(experiment_path, 0, 'courtship_1_3')\n",
    "\n",
    "        courtship_fly1 = courtship_fly1.loc[:copulation_time-1]\n",
    "        courtship_fly2 = courtship_fly2.loc[:copulation_time-1]\n",
    "\n",
    "        # Get all collected behaviors in a DataFrame.\n",
    "        behaviors = pd.concat([courtship_fly1, courtship_fly2], axis=1)\n",
    "        behaviors.index.name = 'frame'\n",
    "        behaviors.columns = ['courtship_fly1', 'courtship_fly2']\n",
    "        behaviors.fillna(method='ffill', inplace=True)\n",
    "\n",
    "        # Get overall courtship as well as courtship before and after first copulation.\n",
    "        fly_number = [fly.split('_')[1] for fly in behaviors.columns]\n",
    "        for fly in fly_number:\n",
    "            courtship_on, _ = np.array(helpers.detect_events(behaviors['courtship_'+fly]))\n",
    "            all_courtship = behaviors[behaviors['courtship_'+fly]==True]\n",
    "            nframes_courtship = all_courtship.shape[0]\n",
    "            nbouts_courtship = len(courtship_on)\n",
    "\n",
    "            if condition=='virgin_virgin':\n",
    "                if comment.split('_')[0]=='painted' and fly=='fly2':\n",
    "                    cop_id = 'copulated'\n",
    "                elif comment.split('_')[0]=='unpainted' and fly=='fly1':\n",
    "                    cop_id = 'copulated'\n",
    "                else:\n",
    "                    cop_id = 'not_copulated'\n",
    "            else:\n",
    "                if comment.split('_')[1]=='virgin' and fly=='fly1':\n",
    "                    cop_id = 'copulated'\n",
    "                elif comment.split('_')[1].startswith('mated') and fly=='fly2':\n",
    "                    cop_id = 'copulated'\n",
    "                else:\n",
    "                    cop_id = 'not_copulated'\n",
    "\n",
    "            # Get latency to first courtship bout.\n",
    "            try:\n",
    "                courtship_latency = courtship_on[0]\n",
    "            except IndexError:\n",
    "                courtship_latency = 215999\n",
    "                \n",
    "            # Get normalized amount of courtship.\n",
    "            courtship_ratio = nframes_courtship / (copulation_time - 1 - courtship_latency)\n",
    "            bouts_ratio = nbouts_courtship / (copulation_time - 1 - courtship_latency)\n",
    "    \n",
    "            courtship_data = pd.DataFrame({'nframes': nframes_courtship,\n",
    "                                           'nbouts': nbouts_courtship,\n",
    "                                           'ratio_frames': courtship_ratio,\n",
    "                                           'ratio_bouts': bouts_ratio,\n",
    "                                           'latency': courtship_latency,\n",
    "                                           'latency_mins': courtship_latency / (60 * FPS),\n",
    "                                           'fly_id': fly[-1],\n",
    "                                           'cop_id': cop_id,\n",
    "                                           'experiment': experiment_name,\n",
    "                                           'condition': condition},\n",
    "                                           index=[0]\n",
    "                                          )\n",
    "\n",
    "            courtship_df = pd.concat([courtship_df, courtship_data], ignore_index=True)\n",
    "\n",
    "courtship_df = courtship_df[['nbouts',\n",
    "                             'nframes',\n",
    "                             'ratio_bouts',\n",
    "                             'ratio_frames',\n",
    "                             'latency',\n",
    "                             'latency_mins',\n",
    "                             'fly_id',\n",
    "                             'cop_id',\n",
    "                             'experiment',\n",
    "                             'condition',\n",
    "                           ]]\n",
    "\n",
    "courtship_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Does the female that copulates receive more courtship?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "      <th>cop_id</th>\n",
       "      <th>ratio_frames</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4</td>\n",
       "      <td>copulated</td>\n",
       "      <td>0.497155</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4</td>\n",
       "      <td>not_copulated</td>\n",
       "      <td>0.306649</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T14_34_55_arena2</td>\n",
       "      <td>not_copulated</td>\n",
       "      <td>0.452359</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T14_34_55_arena2</td>\n",
       "      <td>copulated</td>\n",
       "      <td>0.479852</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T13_42_13_arena1</td>\n",
       "      <td>copulated</td>\n",
       "      <td>0.549916</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>185</th>\n",
       "      <td>virgin_mated2h</td>\n",
       "      <td>video_2017-12-19T16_23_33_arena2</td>\n",
       "      <td>not_copulated</td>\n",
       "      <td>0.605366</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>186</th>\n",
       "      <td>virgin_mated2h</td>\n",
       "      <td>video_2017-12-19T16_23_33_arena3</td>\n",
       "      <td>copulated</td>\n",
       "      <td>0.486260</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>187</th>\n",
       "      <td>virgin_mated2h</td>\n",
       "      <td>video_2017-12-19T16_23_33_arena3</td>\n",
       "      <td>not_copulated</td>\n",
       "      <td>0.455098</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>188</th>\n",
       "      <td>virgin_mated2h</td>\n",
       "      <td>video_2017-12-20T15_08_53_arena2</td>\n",
       "      <td>copulated</td>\n",
       "      <td>0.415853</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>189</th>\n",
       "      <td>virgin_mated2h</td>\n",
       "      <td>video_2017-12-20T15_08_53_arena2</td>\n",
       "      <td>not_copulated</td>\n",
       "      <td>0.021164</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>190 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          condition                        experiment         cop_id  \\\n",
       "0     virgin_virgin  video_2017-09-05T13_28_41_arena4      copulated   \n",
       "1     virgin_virgin  video_2017-09-05T13_28_41_arena4  not_copulated   \n",
       "2     virgin_virgin  video_2017-09-05T14_34_55_arena2  not_copulated   \n",
       "3     virgin_virgin  video_2017-09-05T14_34_55_arena2      copulated   \n",
       "4     virgin_virgin  video_2017-09-06T13_42_13_arena1      copulated   \n",
       "..              ...                               ...            ...   \n",
       "185  virgin_mated2h  video_2017-12-19T16_23_33_arena2  not_copulated   \n",
       "186  virgin_mated2h  video_2017-12-19T16_23_33_arena3      copulated   \n",
       "187  virgin_mated2h  video_2017-12-19T16_23_33_arena3  not_copulated   \n",
       "188  virgin_mated2h  video_2017-12-20T15_08_53_arena2      copulated   \n",
       "189  virgin_mated2h  video_2017-12-20T15_08_53_arena2  not_copulated   \n",
       "\n",
       "     ratio_frames  \n",
       "0        0.497155  \n",
       "1        0.306649  \n",
       "2        0.452359  \n",
       "3        0.479852  \n",
       "4        0.549916  \n",
       "..            ...  \n",
       "185      0.605366  \n",
       "186      0.486260  \n",
       "187      0.455098  \n",
       "188      0.415853  \n",
       "189      0.021164  \n",
       "\n",
       "[190 rows x 4 columns]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "court_amount_by_cop_df = courtship_df.copy()\n",
    "court_amount_by_cop_df = court_amount_by_cop_df[['condition', 'experiment', 'cop_id', 'ratio_frames']].dropna()\n",
    "court_amount_by_cop_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Outliers"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\t virgin_virgin \n",
      "\n",
      "copulated\n",
      "[]\n",
      "Number data points considered outliers: 0\n",
      "Percent data points considered outliers: 0.0 %\n",
      "not_copulated\n",
      "[]\n",
      "Number data points considered outliers: 0\n",
      "Percent data points considered outliers: 0.0 %\n",
      "\n",
      "\t virgin_mated24h \n",
      "\n",
      "copulated\n",
      "[]\n",
      "Number data points considered outliers: 0\n",
      "Percent data points considered outliers: 0.0 %\n",
      "not_copulated\n",
      "[]\n",
      "Number data points considered outliers: 0\n",
      "Percent data points considered outliers: 0.0 %\n",
      "\n",
      "\t virgin_mated2h \n",
      "\n",
      "copulated\n",
      "[]\n",
      "Number data points considered outliers: 0\n",
      "Percent data points considered outliers: 0.0 %\n",
      "not_copulated\n",
      "[]\n",
      "Number data points considered outliers: 0\n",
      "Percent data points considered outliers: 0.0 %\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "      <th>cop_id</th>\n",
       "      <th>ratio_frames</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4</td>\n",
       "      <td>copulated</td>\n",
       "      <td>0.497155</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T14_34_55_arena2</td>\n",
       "      <td>copulated</td>\n",
       "      <td>0.479852</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T13_42_13_arena1</td>\n",
       "      <td>copulated</td>\n",
       "      <td>0.549916</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T14_45_32_arena3</td>\n",
       "      <td>copulated</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-07T14_37_38_arena3</td>\n",
       "      <td>copulated</td>\n",
       "      <td>0.878968</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>181</th>\n",
       "      <td>virgin_mated2h</td>\n",
       "      <td>video_2017-12-19T15_13_55_arena3</td>\n",
       "      <td>not_copulated</td>\n",
       "      <td>0.327377</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>183</th>\n",
       "      <td>virgin_mated2h</td>\n",
       "      <td>video_2017-12-19T16_23_33_arena1</td>\n",
       "      <td>not_copulated</td>\n",
       "      <td>0.218108</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>185</th>\n",
       "      <td>virgin_mated2h</td>\n",
       "      <td>video_2017-12-19T16_23_33_arena2</td>\n",
       "      <td>not_copulated</td>\n",
       "      <td>0.605366</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>187</th>\n",
       "      <td>virgin_mated2h</td>\n",
       "      <td>video_2017-12-19T16_23_33_arena3</td>\n",
       "      <td>not_copulated</td>\n",
       "      <td>0.455098</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>189</th>\n",
       "      <td>virgin_mated2h</td>\n",
       "      <td>video_2017-12-20T15_08_53_arena2</td>\n",
       "      <td>not_copulated</td>\n",
       "      <td>0.021164</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>190 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          condition                        experiment         cop_id  \\\n",
       "0     virgin_virgin  video_2017-09-05T13_28_41_arena4      copulated   \n",
       "3     virgin_virgin  video_2017-09-05T14_34_55_arena2      copulated   \n",
       "4     virgin_virgin  video_2017-09-06T13_42_13_arena1      copulated   \n",
       "7     virgin_virgin  video_2017-09-06T14_45_32_arena3      copulated   \n",
       "9     virgin_virgin  video_2017-09-07T14_37_38_arena3      copulated   \n",
       "..              ...                               ...            ...   \n",
       "181  virgin_mated2h  video_2017-12-19T15_13_55_arena3  not_copulated   \n",
       "183  virgin_mated2h  video_2017-12-19T16_23_33_arena1  not_copulated   \n",
       "185  virgin_mated2h  video_2017-12-19T16_23_33_arena2  not_copulated   \n",
       "187  virgin_mated2h  video_2017-12-19T16_23_33_arena3  not_copulated   \n",
       "189  virgin_mated2h  video_2017-12-20T15_08_53_arena2  not_copulated   \n",
       "\n",
       "     ratio_frames  \n",
       "0        0.497155  \n",
       "3        0.479852  \n",
       "4        0.549916  \n",
       "7        1.000000  \n",
       "9        0.878968  \n",
       "..            ...  \n",
       "181      0.327377  \n",
       "183      0.218108  \n",
       "185      0.605366  \n",
       "187      0.455098  \n",
       "189      0.021164  \n",
       "\n",
       "[190 rows x 4 columns]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "corrected_court_amount_by_cop = pd.DataFrame()\n",
    "\n",
    "for condition in condition_order:\n",
    "    \n",
    "    print('\\n\\t', condition, '\\n')\n",
    "\n",
    "    try:\n",
    "\n",
    "        for cop in court_amount_by_cop_df['cop_id'].unique():\n",
    "\n",
    "            print(cop)\n",
    "\n",
    "            dataset = court_amount_by_cop_df.query('condition==\"' + condition + '\" and cop_id==\"' + cop + '\"')['ratio_frames']\n",
    "\n",
    "            outlier_positions = helpers.check_outliers(dataset)\n",
    "            print(outlier_positions)\n",
    "\n",
    "            fresh_dataset = pd.DataFrame(helpers.remove_outliers(dataset, indices=outlier_positions))\n",
    "            fresh_dataset['condition'] = condition\n",
    "\n",
    "            corrected_court_amount_by_cop = pd.concat([corrected_court_amount_by_cop, fresh_dataset], axis=0)\n",
    "\n",
    "    except IndexError:\n",
    "        print('No second copulation for condition', condition)\n",
    "\n",
    "court_amount_by_cop = court_amount_by_cop_df.copy().loc[corrected_court_amount_by_cop.index]\n",
    "court_amount_by_cop"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Statistics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\t virgin_virgin \n",
      "\n",
      "Shapiro's Test: group 1 IS normally distributed.\n",
      "D'Agostino's Test: group 1 IS normally distributed.\n",
      "Shapiro's Test: group 2 IS normally distributed.\n",
      "D'Agostino's Test: group 2 IS normally distributed.\n",
      "Bartlett's Test for normally distribted samples:\n",
      "  p-value = 0.106593\n",
      "  All groups were sampled from populations with IDENTICAL variances.\n",
      "\n",
      "Independent measures (two sample) t-test p-value: 1.1262773974070846e-06 \n",
      "\n",
      "\n",
      "\t virgin_mated24h \n",
      "\n",
      "Shapiro's Test: group 1 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 1 IS NOT normally distributed.\n",
      "Shapiro's Test: group 2 IS normally distributed.\n",
      "D'Agostino's Test: group 2 IS normally distributed.\n",
      "Levene's Test for non-normally distributed samples:\n",
      "  p-value = 0.546522\n",
      "  All groups were sampled from populations with IDENTICAL variances.\n",
      "\n",
      "Mann-Whitney p-value: 0.3865599712337615 \n",
      "\n",
      "\n",
      "\t virgin_mated2h \n",
      "\n",
      "Shapiro's Test: group 1 IS normally distributed.\n",
      "D'Agostino's Test: group 1 IS normally distributed.\n",
      "Shapiro's Test: group 2 IS normally distributed.\n",
      "D'Agostino's Test: group 2 IS normally distributed.\n",
      "Bartlett's Test for normally distribted samples:\n",
      "  p-value = 0.715278\n",
      "  All groups were sampled from populations with IDENTICAL variances.\n",
      "\n",
      "Independent measures (two sample) t-test p-value: 0.7500543446355188 \n",
      "\n"
     ]
    }
   ],
   "source": [
    "court_amount_by_cop_pvalues = {}\n",
    "\n",
    "for condition in condition_order:\n",
    "    \n",
    "    print('\\n\\t', condition, '\\n')\n",
    "    \n",
    "    try:\n",
    "        data_condition = {condition + '_no_cop': court_amount_by_cop.query('condition==\"' + condition + '\" and cop_id==\"not_copulated\"')['ratio_frames'],\n",
    "                          condition + '_cop': court_amount_by_cop.query('condition==\"' + condition + '\" and cop_id==\"copulated\"')['ratio_frames']\n",
    "                         }\n",
    "        \n",
    "        pvalue_condition = helpers.run_statistics(data_condition)\n",
    "        \n",
    "        court_amount_by_cop_pvalues[condition] = pvalue_condition\n",
    "        \n",
    "    except ValueError as error:\n",
    "        print(error)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Bonferroni Correction\n",
      "---------------------\n",
      "\n",
      "\tOriginal Values:\n",
      " {'virgin_virgin': 1.1262773974070846e-06, 'virgin_mated24h': 0.3865599712337615, 'virgin_mated2h': 0.7500543446355188}\n",
      "\n",
      "\tCorrected Values:\n",
      " {'virgin_virgin': 3.378832192221254e-06, 'virgin_mated24h': 1.0, 'virgin_mated2h': 1.0} \n",
      "\n"
     ]
    }
   ],
   "source": [
    "# Bonferroni corretction for multiple comparisons.\n",
    "title = 'Bonferroni Correction'\n",
    "print(title)\n",
    "print('-'*len(title))\n",
    "\n",
    "# Show uncorrected values.\n",
    "print('\\n\\tOriginal Values:\\n', court_amount_by_cop_pvalues)\n",
    "\n",
    "# Apply the bonferroni correction for multiple comparisons.\n",
    "court_amount_by_cop_multi_comp_correction = multipletests(pvals=list(court_amount_by_cop_pvalues.values()), alpha=0.05, method='bonferroni')[1]\n",
    "\n",
    "# Transform the correction results into a dictionary.\n",
    "corrected_court_amount_by_cop_pvalues = dict(zip(list(court_amount_by_cop_pvalues.keys()), court_amount_by_cop_multi_comp_correction))\n",
    "\n",
    "# Show corrected values.\n",
    "print('\\n\\tCorrected Values:\\n', corrected_court_amount_by_cop_pvalues, '\\n')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Effect Size"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "virgin_virgin\n",
      "Large Efect: 0.8580902905090307 \n",
      "\n",
      "virgin_mated24h\n",
      "Vestigial Effect: 0.05504815043054119 \n",
      "\n",
      "virgin_mated2h\n",
      "Vestigial Effect: 0.09661925841246749 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'virgin_virgin': 0.8580902905090307,\n",
       " 'virgin_mated24h': 0.05504815043054119,\n",
       " 'virgin_mated2h': 0.09661925841246749}"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "court_amount_by_cop_effect_sizes = {}\n",
    "\n",
    "for condition in condition_order:\n",
    "    \n",
    "    print(condition)\n",
    "    \n",
    "    control = court_amount_by_cop_df.query('condition==\"' + condition + '\" and cop_id==\"not_copulated\"')['ratio_frames']\n",
    "    test = court_amount_by_cop_df.query('condition==\"' + condition + '\" and cop_id==\"copulated\"')['ratio_frames']\n",
    "\n",
    "    median_diff = helpers.get_effect_size(control, test, method='median_diff')\n",
    "    \n",
    "    court_amount_by_cop_effect_sizes[condition] = median_diff\n",
    "    \n",
    "court_amount_by_cop_effect_sizes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXYAAAEvCAYAAABR3+paAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAA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HB22+/jb///htAvVCtWLECVlZW+P777/HRRx/Bx8cHhBDs27cP7dq1w9q1azFz5kx4enqid+/eWk3FqJojTREcHIwtW7agT58+IIQgICAAGRkZAOpTd3PnzkVcXBz279+PuXPn4uuvv4a5uTkOHToEFouF2NhYvP/++9i+fTv69euHdu3aaWxslJYF7XmqYfbt24devXph8ODBKCwsREBAAHJzc2FiQi+OKBSKbqARu4bp3bs35s6dC5FIBBMTE2zbto2KOoVC0Sk0YqdQKBQjg4aSFAqFYmRQYadQKBQjgwo7hUKhGBlU2CkUCsXIoMJOoVAoRgYVdgqFQjEyqLBTKBSKkUGFnUKhUIwMKuwUCoViZFBhp1AoFCODCjuFQqEYGVTYKRQKxcigwk6hUChGBhV2CoVCMTKosFMoFIqRQYWdQqFQjAwq7BQKhWJkUGGnUCgUI4MKO4VCoRgZVNgpFArFyPj/UtGqNDeoWXwAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 270x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Initialize figure.\n",
    "n_conditions = court_amount_by_cop_df['condition'].nunique()\n",
    "figure, axis = plt.subplots(figsize=(1.25*n_conditions, 4))\n",
    "\n",
    "# Draw the boxplot.\n",
    "sns.boxplot(x='condition',\n",
    "            y='ratio_frames',\n",
    "            data=court_amount_by_cop_df,\n",
    "            order=condition_order,\n",
    "            hue='cop_id',\n",
    "            hue_order=['copulated', 'not_copulated'],\n",
    "            showfliers=False,\n",
    "            boxprops={'edgecolor': INK},\n",
    "            medianprops={'color': INK},\n",
    "            whiskerprops={'color': INK},\n",
    "            capprops={'color': INK}\n",
    "           )\n",
    "\n",
    "# Draw the swarmplot.\n",
    "sns.swarmplot(x='condition',\n",
    "              y='ratio_frames',\n",
    "              data=court_amount_by_cop_df,\n",
    "              order=condition_order,\n",
    "              hue='cop_id',\n",
    "              hue_order=['copulated', 'not_copulated'],\n",
    "              linewidth=1.0,\n",
    "              edgecolor=INK,\n",
    "              dodge=True\n",
    "             )\n",
    "\n",
    "# Format boxplot grouping colors and hatching.\n",
    "for b, boxplot in enumerate(axis.artists):\n",
    "    if b < 2:\n",
    "        boxplot.set_facecolor('steelblue')\n",
    "    elif b > 3:\n",
    "        boxplot.set_facecolor('#fB929e')\n",
    "    else:\n",
    "        boxplot.set_facecolor('#d72323')\n",
    "    if b % 2 != 0:\n",
    "        boxplot.set_hatch('///')\n",
    "\n",
    "# Format swarmplot grouping colors.\n",
    "for s, swarmplot in enumerate(axis.collections):\n",
    "    if s < 2:\n",
    "        swarmplot.set_facecolor('steelblue')\n",
    "    elif s > 3:\n",
    "        swarmplot.set_facecolor('#fB929e')\n",
    "    else:\n",
    "        swarmplot.set_facecolor('#d72323')\n",
    "\n",
    "# Figure and axes formatting.\n",
    "axis.set_xlabel('')\n",
    "axis.set_xticklabels([''])\n",
    "axis.set_ylabel('Amount of Courtship Received (%)')\n",
    "axis.set_ylim(0, 1.015)\n",
    "axis.set_yticks(np.arange(0, 1+0.1, 0.2))\n",
    "axis.set_yticklabels([int(y*100) for y in axis.get_yticks()])\n",
    "\n",
    "# Legend formatting.\n",
    "legend_handles, _ = axis.get_legend_handles_labels()\n",
    "for h, handle in enumerate(legend_handles):\n",
    "    handle.set_facecolor('white')\n",
    "    handle.set_linewidth(1.0)\n",
    "    handle.set_edgecolor(INK)\n",
    "    if h > 0:\n",
    "        handle.set_hatch('///')\n",
    "\n",
    "axis.legend(handles=legend_handles[0:2],\n",
    "            labels=['Mating', 'Non-mating'],\n",
    "            title='Female ID',\n",
    "            title_fontsize=13,\n",
    "            bbox_to_anchor=(1.02, 1.03)\n",
    "           )\n",
    "\n",
    "# Table definition.\n",
    "row1 = [str(court_amount_by_cop_df.query('condition==\"'+condition+'\"')['experiment'].nunique()) for condition in condition_order]\n",
    "row2 = ['virgin\\n', '24h-mated\\n', '2h-mated\\n']\n",
    "cell_text = np.array([row1, row2])\n",
    "\n",
    "row_labels = ['n =', '']\n",
    "summary_table = axis.table(cellText= cell_text,\n",
    "                           cellLoc='center',\n",
    "                           rowLabels=row_labels,\n",
    "                           rowLoc='center',\n",
    "                           colLoc='center'\n",
    "                          )\n",
    "\n",
    "summary_table.auto_set_font_size(False)\n",
    "summary_table.set_fontsize(11)\n",
    "\n",
    "properties = summary_table.properties()\n",
    "table_cells = properties['children']\n",
    "for cell in table_cells:\n",
    "    cell.set_height(0.12)\n",
    "    cell.set_alpha(0)\n",
    "\n",
    "# Draw statistical results.\n",
    "for p, condition in enumerate(condition_order):\n",
    "    sig_height = 6 if (corrected_court_amount_by_cop_pvalues.get(condition, 'NaN') == 'NaN') or (corrected_court_amount_by_cop_pvalues.get(condition, 'NaN') >= 0.05) else 2\n",
    "    helpers.plot_stattest_result(ax=axis,\n",
    "                                 x1=p-0.2,\n",
    "                                 x2=p+0.2,\n",
    "                                 p_value=corrected_court_amount_by_cop_pvalues.get(condition, 'NaN'),\n",
    "                                 y=1.05,\n",
    "                                 ticksize=0.02,\n",
    "                                 xytext=(0,sig_height),\n",
    "                                 fontsize=13,\n",
    "                                 color=INK,\n",
    "                                 connector_color=INK\n",
    "                                )\n",
    "\n",
    "# Saving parameters.\n",
    "filename = 'amount_of_courtship_by_copulation_mating_drive'\n",
    "plt.savefig(os.path.join(savepath, filename))\n",
    "\n",
    "plt.show()\n",
    "plt.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
